package model

import (
	"time"
	"tools-api/src/common/db/database"
)

// UserIpLimit IP黑名单
type UserIpLimit struct {
	Id         int64     `json:"-"`
	Ip         string    `json:"-"` // ip
	CreatedAt  time.Time `xorm:"created" json:"-"`
	ModifiedAt time.Time `xorm:"updated" json:"-"`
	DeleteMark int       `xorm:"delete_mark" json:"-"`
}

func (UserIpLimit) Exist(ip string) bool {
	exist, err := database.JCJEngine.Where("ip=?", ip).Exist(&UserIpLimit{})
	if err != nil {
		return true
	}
	return exist
}
